function mat = oneHotEncode(label, size)

% encoding categorical variable value 
% to one-hot-encoding scheme
% 
% input: label, size
%
% output: one-hot-encoded mat

if ~exist('size', 'var') || isempty(size)
    size = 10;
end

if label > size
    error('Label (%d) should be < size (%d).', label, size);
end

I = eye(size);
mat = I(:, label);

end